/*
 * Ingredient.java
 *
 * Created on 30 octobre 2007, 18:47
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.ifips5.nal.epizza.web.model;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Moi
 */
@XmlRootElement(name = "ingredient")
public class Ingredient implements Serializable
{
    @XmlAttribute(name = "id")
    private int idIngredient;
    
    @XmlAttribute(name = "name")
    @XmlID
    private String name;
    
    @XmlAttribute(name = "stock")
    private int stock;
    
    
    /** Creates a new instance of Ingredient */
    public Ingredient()
    {
    }
    
    
    public Ingredient(int id, String name, int stock)
    {
        this.setIdIngredient(id);
        this.name = name;
        this.stock = stock;
    }
    
    
    //////////////////////
    // Getters and Setters
    
    public String getName()
    {
        return name;
    }

    @XmlTransient
    public void setName(String name)
    {
        this.name = name;
    }

    public int getStock()
    {
        return stock;
    }

    @XmlTransient
    public void setStock(int stock)
    {
        this.stock = stock;
    }

    public int getIdIngredient()
    {
        return idIngredient;
    }

    @XmlTransient
    public void setIdIngredient(int idIngredient)
    {
        this.idIngredient = idIngredient;
    }
    
    public void decrementStock()
    {
        this.stock --;
    }
    
}
